Skip to content

test(html): validate generated HTML is well-formed#812

Merged
crowlKats merged 1 commit into
mainfrom
html-validation-tests-634
Jun 5, 2026
Merged

test(html): validate generated HTML is well-formed#812
crowlKats merged 1 commit into
mainfrom
html-validation-tests-634

Conversation

@crowlbot

@crowlbot crowlbot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

What

Sets up HTML validation in the HTML test suite (issue #634): generated HTML should be checked for missing closing tags / invalid markup, not just snapshot-compared.

assert_generated_html_is_valid parses every generated .html file with a real HTML5 parser (html5ever + markup5ever_rcdom) and asserts the parse produced no errors. It's wired in via html_output_is_valid, which runs it over the comprehensive multiple fixture (classes, interfaces, enums, type aliases, namespaces, drilldown member pages, redirects, and the all-symbols/index pages).

Fix surfaced while setting this up

The validator immediately caught one real defect: the symbol redirect pages (e.g. ~/Foo.prototype.html) were emitted as a bare <meta http-equiv="refresh" …> with no surrounding document — not a valid HTML document. The content pages were all already clean.

The redirect template is now a complete HTML document (doctype, <head> with charset/title, <body>) with a visible fallback link for users whose browsers don't honor the meta refresh. With that, every generated page validates.

Notes

  • html5ever/markup5ever_rcdom are added as dev-dependencies only.
  • The redirect-page snapshots are updated to the new document; no content-page output changed.
  • The new test fails before the redirect fix (the redirect pages report Unexpected token) and passes after.

Fixes #634

Adds an HTML5-parser-based check (html5ever) that parses every generated
HTML file and asserts it has no parse errors, wired into the test suite
via `html_output_is_valid` over the comprehensive "multiple" fixture.

Setting this up surfaced one real defect: the symbol redirect pages were
emitted as a bare `<meta http-equiv="refresh">` with no document
structure, which is not a valid HTML document. Make the redirect template
a complete document (doctype/head/body) with a visible fallback link, so
all generated HTML now validates.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@crowlKats crowlKats merged commit 255df58 into main Jun 5, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set up html validation in HTML tests

3 participants